package com.example.user;

import com.example.model.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
public class UserController {

    @Value("${config.user.name}")
    private String userName;

    @RequestMapping("/user")
    public User user(Integer age){
        System.out.println(this.userName);
        User user =new User();
        user.setUserName(userName);
        user.setAge(age);
        return user;
    }
}
